<template>
    <div class="btn">
        <div v-if="food.count" class="button" @click="btn(false,food)">-</div>
        <div class="count" v-if="food.count">{{food.count}}</div>
        <div class="button" @click="btn(true,food)">+</div>
    </div>
</template>

<script>
export default {
    props:{
        food:Object
    },
    methods:{
        btn(some,food){
            this.$store.dispatch('updateFoodCount',{some,food})
        }
    }
};
</script>

<style lang="less" scoped>

.btn{
    display: flex;
    .button{
    color: white;
    text-align: center;
    width: 20px;
    height: 20px;
    background-color: pink;
    }
    .count{
        width: 20px;
        height: 20px;
        line-height:  20px;
        text-align: center;
    }
}
</style>

